package com.itheima.feign.impl;

import com.itheima.feign.ItemFeign;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author：shenkunlin
 * @date： 2021/7/13 12:28
 * @Description：
 ***/
@Component
public class ItemFeignFallbackFactory implements FallbackFactory<ItemFeign> {

    /***
     * 降级处理
     * @param throwable
     * @return
     */
    @Override
    public ItemFeign create(Throwable throwable) {
        return new ItemFeign() {
            @Override
            public int decrCount(Integer id, Integer count) {
                System.out.println("------服务降级处理--!!!!!!");
                return -80;
            }
        };
    }
}
